package com.tjetc.controller;

import com.tjetc.domain.Alternate;
import com.tjetc.service.AlternateService;
import com.tjetc.service.impl.AlternateServiceImpl;
import com.tjetc.vo.RankDTO;
import com.tjetc.vo.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (alternate)表控制层
 *
 * @author xxxxx
 */
@RestController
@RequestMapping("/alternate")
public class AlternateController {
    /**
     * 服务对象
     */
    @Resource
    private AlternateService alternateService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public Alternate selectOne(Integer id) {
        return alternateService.selectByPrimaryKey(id);
    }

    @PostMapping("addAlternate")
    public Result addAlternate(@RequestBody RankDTO rankDTO) {
        return alternateService.addAlternate(rankDTO);
    }

    @GetMapping("getAlternateInfo")
    public Result getAlternateInfo(@RequestParam("id") Integer id) {
        return alternateService.getAlternateInfo(id);
    }
    @GetMapping("cancelAlternate")
    public Result cancelAlternate(@RequestParam("id") Integer id) {
        return alternateService.cancelAlternate(id);
    }
}
